﻿/******************************************************************************
* File description: animationPublicInterface.h
* Function: 已弃用
* Current Version: 1.0.0
* Author: JNN
* Date: 2025-07-01
*  -----
*  Copyright by 博坤生物 .
 *****************************************************************************/

#include "animationPublicInterface.h"

AnimationPublicInterface::AnimationPublicInterface()
{

}

AnimationPublicInterface& AnimationPublicInterface::I(){
    static AnimationPublicInterface instance;
    return instance;
}

/** @brief 初始化state指针 */
void AnimationPublicInterface::initState(AnimationState_Shifting *state_shifting, AnimationState_Practice *state_practice, AnimationState_Purify *state_purify){
    __LOG_FSTART__;
    _state_shifting = state_shifting;
    _state_practice = state_practice;
    _state_purify = state_purify;
    __LOG_FEND__;
}



/** @brief 错误消息处理（已弃用） */
void AnimationPublicInterface::handleErrorMsg(QString errorMsg, int module){


    __LOG_FSTART("Msg:"+errorMsg + " Module:" + QString::number(module));

    if((!_state_purify) || (!_state_shifting) || (!_state_practice)){
        __LOG_ERROR("state=nullptr");
        __LOG_FEND__;
        return;
    }

    qDebug() << "动画处理错误消息" << errorMsg << module;

    if(errorMsg.contains("1号注射器")){
        _state_purify->changeSyringeErrorState(1, -1);
    }else if(errorMsg.contains("2号注射器")){
        _state_purify->changeSyringeErrorState(2, -1);
    }else if(errorMsg.contains("3号注射器")){
        _state_purify->changeSyringeErrorState(3, -1);
    }else if(errorMsg.contains("4号注射器")){
        _state_purify->changeSyringeErrorState(4, -1);
    }else if(errorMsg.contains("5号注射器")){
        _state_purify->changeSyringeErrorState(5, -1);
    }else if(errorMsg.contains("6号注射器")){
        _state_purify->changeSyringeErrorState(6, -1);
    }else if(errorMsg.contains("7号注射器")){
        _state_purify->changeSyringeErrorState(7, -1);
    }

    else if(errorMsg.contains("传靶气泵")){
        if(module == 1){
            _state_shifting->setBlowTargetState(-1);
        }else if(module == 2){
            _state_practice->setBlowTargetState(-1);
        }
    }
    else if(errorMsg.contains("盖盖")){
        _state_shifting->setCapCraneState(-1);
    }
    else if(errorMsg.contains("废液瓶")){

    }
    else if(errorMsg.contains("产物瓶")){

    }
    else if(errorMsg.contains("靶材罐")){

    }
    else if(errorMsg.contains("开盖")){
        _state_shifting->setCapCraneState(-1);
    }
    else if(errorMsg.contains("取靶")){
        _state_shifting->setTargetCraneState(-1);
    }
    else if(errorMsg.contains("夹爪")){
        _state_shifting->setClampState(-1);
    }
    else if(errorMsg.contains("气泵水泵")){
        _state_practice->setPump1State(-1);
        _state_practice->setPump2State(-1);
    }

    __LOG_FEND__;

}
